package FileInformation.helpers;


import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.LineNumberReader;
import java.io.Serializable;

/**
 * Created by IntelliJ IDEA.
 * User: Nobody
 * Date: 25.04.11
 * Time: 21:15
 * To change this template use File | Settings | File Templates.
 */
public class LineCounter extends AbstractFileHelper implements Serializable {
     private int lines;

    public LineCounter(File file) {
        super(file);
    }

    public int getLines() {
        return lines;
    }

    @Override
    public void execute() throws IOException {
           LineNumberReader lnr = new LineNumberReader(new FileReader(file));
           lnr.skip(Long.MAX_VALUE);
           lines =  lnr.getLineNumber();
       }

}
